Conventionally, the JPEG system, standardized by the ISO (International Organization for Standardization) is widely used as a coding scheme for storing a still image on a storage medium such as a CD-ROM or hard disk and displaying the image. A still image coded by the JPEG method includes a header portion having information necessary for decoding such as an image size and sampling coefficients of color components, and an entropy coded image data portion (ECS).
Regarding the ECS portion, in a block interleave scheme for repeatedly encoding color components by 8×8 pixel block, the minimum unit in all the coded color component blocks based on sampling coefficients is called a minimum coding unit (MCU). For example, in an image with luminance Y, color chrominance Cb and Cr as color components, and the sampling coefficients at a ratio of 4:2:2, 4 blocks (Y, Y, Cb, Cr) constitute 1 MCU.
On the other hand, an identifier called “restart marker” can be added to the ECS portion at MCU-based arbitrary periods. When a code data string including an error due to some reason is decoded, the influence of the error can be suppressed in the restart marker period. As the location of the restart marker is defined in the byte boundary of the ECS, if the MCU within an ECS immediately prior to insertion of the restart marker is not ended at the byte boundary, plural (1 to 7 bits) “1”, called “padding bits”, are inserted within the ECS then the restart marker is inserted.
Further, the MPEG system, standardized by the ISO is widely used as a coding scheme for storing a moving image on a storage medium such as a CD-ROM or hard disk and displaying the image, and for broadcasting or bidirectional communication using a moving image via a communication path. A moving image coded by the MPEG method includes a header portion having information necessary for decoding such as an image size and quantization scaling value for quantization and uniform scaling of respective pixels, and an entropy-coded image data portion (macro block).
The macro block structure limited by the MPEG system has a size of 16 pixels×16 pixels, and has color components including luminance Y and chrominance Cb and Cr. The respective color components are subsampled at the ratio of 4:1:1 by 8×8 pixel block.
On the other hand, the MPEG system has a processing unit called a slice including plural macro blocks, and a layer having plural slices is called a slice layer. As an identifier called slice start code is always exists in the byte boundary at the head of slice, if a code data string including an error due to some reason is decoded, the influence of the error can be suppressed in the slice period. If one slice is not ended in the byte boundary, plural (1 to 7 bits) “0”, called “padding bits”, are inserted within the code data string then the slice start code is inserted.
In recent years, some image coding apparatuses generate a code data string in cooperation with a main control unit used in a system including the image coding apparatus or a specialized main control unit in the image coding apparatus. In such arrangement, generally, the main control unit which can perform flexible processing generates the header portion, and a specialized hardware generates the ECS or macro block portion at a high speed.
FIG. 9 shows an example of conventional image coding apparatus in conformity to the JPEG or MPEG system. First, a header portion outputted from a main control unit 10, in which a control method can be changed by stored software, is selected by a selector 600 and outputted to the outside. Then, image data input is started, and coding is performed on the ECS or macro block portion. The input image data is converted by a DCT unit 200 into DCT coefficients, then the DCT coefficients are quantized by a quantization unit 300, and converted by a run-length coding unit 400 into symbols of run-length and level. Finally, the symbols are variable-length encoded by a variable-length encoder 500, then padding bits and identifier are inserted in the data, then selected by the selector 600 and outputted as the ECS or macro block portion to the outside.
In the conventional image coding apparatus, as the variable-length encoder 500 inserts an identifier such as the restart marker or slice start code which differs by coding scheme into the variable-length coded data string, the apparatus has means for generating these identifiers, means for adding appropriate padding bits to the generated restart marker or slice start code and means for inserting the restart marker or slice start code to which the padding bits are added into the variable-length coded data string, as specialized hardware devices. Thus the circuit scale of the apparatus is large.
Further, to insert other identifiers, e.g., in the JPEG system, an EOI marker indicating the end of code data string or a DNL marker re-defining the number of input image lines, or in the MPEG system, a picture header necessary in a picture layer constructing one image which is a higher-order layer of the slice layer, into the code data string, hardware devices for the respective identifiers are required. Thus it is difficult to perform flexible identifier insertion processing.
Further, in the conventional image coding apparatus, once coding of ECS in the JPEG system or picture layer in the MPEG system is started, the apparatus self-operates until the coding of all the symbols are completed in the variable-length encoder 500. Accordingly, upon code amount control, even if the amount of generated code exceeds a target amount, the amount of generated code cannot be evaluated before completion of coding of all the ECS portion or picture layer.
Further, in the conventional image coding apparatus, in the event of mishap in coding due to some factor during coding of ECS in the JPEG system or picture layer in the MPEG system, it is difficult to detect the mishap and perform adaptive control.